package com.dawnClass.util;

public class ServiceResponse {
    private int code;
    private String reason;
    private Object data;

    public ServiceResponse(){};
    public ServiceResponse(int code, String reason, Object data) {
        this.code = code;
        this.reason = reason;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public Object getdata() {
        return data;
    }

    public void setdata(Object data) {
        this.data = data;
    }

    public static ServiceResponse saveSuccess(Object data){
        return  new ServiceResponse(200,"添加成功",data);
    }

    public static ServiceResponse saveFail(Object data){
        return  new ServiceResponse(201,"添加成功",data);
    }



    public static ServiceResponse updataSuccess(Object data){
        return  new ServiceResponse(200,"修改成功",data);
    }
    public static ServiceResponse updataFail(Object data){
        return  new ServiceResponse(201,"修改成功",data);
    }


    public static ServiceResponse getSuccess(Object data){
        return  new ServiceResponse(200,"查询成功",data);
    }
    public static ServiceResponse getFail(Object data){
        return  new ServiceResponse(201,"查询失败",data);
    }

    @Override
    public String toString() {
        return "ServiceResponse{" +
                "code=" + code +
                ", reason='" + reason + '\'' +
                ", data=" + data +
                '}';
    }
}
